
package fr.inria.arles.lightPreferencesStore.service;
import fr.inria.arles.lightPreferencesStore.query.AuthenticateQuery;
import fr.inria.arles.lightPreferencesStore.query.GetLightQuery;
import fr.inria.arles.lightPreferencesStore.query.Query;
import fr.inria.arles.lightPreferencesStore.query.RFIDQuery;
import fr.inria.arles.lightPreferencesStore.query.UpdateLightQuery;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author ajay
 */
@WebService(serviceName = "QueryPort")
public class QueryPort {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "RFIDQuery")
    public String RFID(@WebParam(name = "rfid")
    String rfid, @WebParam(name = "partition")
    String partition) throws Exception {
        String request[] = {rfid,partition};
        Query query = new RFIDQuery();
        String res = query.execute(request);
        return res;
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "AuthenticateQuery")
    public String AuthenticateQuery(@WebParam(name = "username")
    String username, @WebParam(name = "password")
    String password, @WebParam(name = "partition")
    String partition) throws Exception {
        String request[] = {username,password,partition};
        Query query = new AuthenticateQuery();
        String res = query.execute(request);
        return res;
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "GetLightQuery")
    public int GetLightQuery(@WebParam(name = "ID")
    String ID) throws Exception {
        String request[] = {ID};
        Query query = new GetLightQuery();
        String res = query.execute(request);
        return Integer.parseInt(res);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "UpdateLightQuery")
    public String UpdateLightQuery(@WebParam(name = "ID")
    String ID,  @WebParam(name = "temp")
    int temp) throws Exception {
        String request[] = {temp+"", ID};
        Query query = new UpdateLightQuery();
        String res = query.execute(request);
        return res;
    }
    
    
}
